Repository navigation
fix(objectql)!: a roll-up summary field is read-only on update whether or not it declares readonly: true - #34752
Conversation
…r or not it declares readonly: true The update's static-readonly schema view (updateStaticReadonlySubject) now reads every `summary` field as `readonly: true`. A person's PATCH, an import with writeMode 'update', a predicate update and the update-mode preview drop the value and report it as `readonly`; strictReadonlyWrites refuses it. The roll-up recompute writes under isSystem, which the static strip exempts, so it keeps writing. Insert is unchanged: a caller's initial value is kept, as the summary note on RUNTIME_OWNED_FIELD_TYPES requires. Claude-Session: https://claude.ai/code/session_01ADHkmNeSWABJwKsumBUZq9 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a189267454139de981fa30aa66a4d47a948de8ab && git checkout a189267454139de981fa30aa66a4d47a948de8ab
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin fff0ad0c180c08ac8de7db8499863bdfb69842e2 bfe6c78aa6ca6b2a2c1bc2c430ffb83599188b11 && git checkout -B drift-repro fff0ad0c180c08ac8de7db8499863bdfb69842e2 && git merge --no-ff bfe6c78aa6ca6b2a2c1bc2c430ffb83599188b11
node scripts/docs-audit/affected-docs.mjs --json fff0ad0c180c08ac8de7db8499863bdfb69842e2 |
…ore copying rows and read without untyped options check:objectql-double-limit graded the new find double as touching rows before the bound; check:query-options-erasure counted the rest pin's untyped findOne options. Claude-Session: https://claude.ai/code/session_01ADHkmNeSWABJwKsumBUZq9 Co-authored-by: Claude <noreply@anthropic.com>
…s read-only on update A caller's blank for a summary field is now dropped on PATCH, batch update and updateMany, so the stored roll-up stays; every other typed column still stores null, and the create doors are unchanged. Claude-Session: https://claude.ai/code/session_01ADHkmNeSWABJwKsumBUZq9 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3 Final head · PR #34752 · 2026-11-17T12:19Z Final head for L1 and L2:
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 76acd4f · 2026-11-17T12:20Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmTHGRTjPqZAcBuo9WH 席位核对L1 first review · ACCEPT · head Checklist (read on GitHub at this head, not from the report)
Before landing (body only, no head move)
Residual (no change asked)
Owed after this
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: Inputs read: card #34672 body and all 6 comments (triage 6939838658, claim 6943806073, follow-up 6943855383, route amendment 6943935029, surface amendment 6946301740, dev report 6947820885; the card carries no maintainer ruling and no earlier contract record); PR #34752 body, 7-file list, the 3 PR comments, and the net diff from merge-base 6091b64 to the head; the check-runs on the head. Check-runs: 59 listed, all completed, every conclusion success or skipped, none failed, none pending. The Dogfood Regression Gate shards are among the skipped ones on this head (see ③). ① Derived judgmentsThe one behavioural hunk is Accept-set changes, each a narrowing, for a summary field that does not declare
What is kept, read in the code:
Public surface: The two forced test edits, as evidence of the narrowing:
② Semver level
③ Boundary flagsSecurity-touching: yes
④ Design judgmentNo must-fix, no should-fix. The narrowing makes the spec's own refusal real; it takes no declared capability away. Read on The placement is sound. Putting the lock in the one view all five update-side passes read means the hook view, the Attempts to break it, and what I found:
N1 (nit) — prose faces. The changeset and the N2 (nit) — the lock keys on N3 (nit) — Implemented-by: VERDICT: PASS |
…for a summary field on update Claude-Session: https://claude.ai/code/session_01ADHkmNeSWABJwKsumBUZq9 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-support-ai · session_01WGufzi8zDwpH6wX7ZPUcHR 席位核对L1 delta review · ACCEPT · Head-sha: Prior records at Delta read (prose only: the changeset and
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: Delta record. It covers Read for this record: card #34672 (body and all 9 comments, scope note 6948112119, hand-off 6948320778 and takeover 6948796553 included), PR #34752 (body, the 6 comments, L2 6948085736, L1 delta ACCEPT 6948959772), the delta diff, and the check-runs on the head: 59, all completed, 42 success and 17 skipped, none failed. Nothing was built or run. ① Derived judgmentsThe delta changes no accept-set and no public surface. It adds five statements to the narrowing's published text. Each is checked against the code at this head.
② Semver levelUnchanged and still right: ③ Boundary flagsSecurity-touching: yes
The escalation: is seat 2's scoping of the insert half (6948112119) sound?Short answer: the scope is sound, one of its two reasons is not, and one thing is owed before landing. It is not a finding on this head. What I verified in the code at this head:
Against the two tests the seat asked for:
So it is a separate gap that needs its own card, and it is not an S item on this PR. The diff is correct and complete for what it claims, and no change to this head would close the gap. But the gap is not a nit either, so it may not stay open without a carrier. Owed by the seat before the Tier H step, none of it moving the head:
给维护者的一句话:本 PR 只锁「更新」,这部分正确、可以落地。「新建」时普通用户仍能给汇总字段带任意初值(卡片第一个复现「没有订单却存了 90」用新建同样能复现),这是卡片 Expected 写到、但本 PR 有意没做的另一半。它与 #6014 的既有设计冲突,需要你单独裁决,所以应另开一张卡,而不是算作本卡之外。另外,#6014 当初要保护的种子数据和历史导入,现在都以系统身份写入,本来就不受限制,所以保留这个口子的理由比席位说明里写的要弱。落地前请席位先把这张卡开出来。 ④ Design judgmentNo must-fix, no should-fix. N1: closed. All three statements L2 asked for are in the changeset and in the docs page, each true against the code (see ①). The added text also names the undo of a historical import, which L2 did not ask for and which is true. The added docs sentences sit in the right place. They follow the page's own two rules (dropped on update, kept on create), and the upsert sentence is tied to them with "therefore". A reader with an older import to undo learns the one surprising answer: the undo does not put the roll-up back, and the next child write does. N2 and N3 from L2 stay as accepted deviations, as L2 recorded them. No new nit on the two delta files. Implemented-by: VERDICT: PASS |
Landing-prep merge for PR #34752 (main at 46991d0). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Red read · PR #34752 · head
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Regen-provenance: 6949128257 · Merge-only hop (main 46991d0): |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Regen-provenance: 6949128257 · Second merge-only hop (main fff0ad0): |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Landing · PR #34752 (card #34672,
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44170242677 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44173524776 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Yibo Wang · project thread
Part of #34672 (the update side; the create side stays open on the card, scope note 6949162788)
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — skills/** teaches
readonly: trueand summary fields but says nothing on what an update does with a value sent for a summary field;content/docs/data-modeling/fields.mdxnow states it维护者速读
Field.summary)在更新时一律只读,不管作者有没有写readonly: true。人用 PATCH 改、导入用writeMode: 'update'改、批量条件更新改、更新预览,送来的汇总值都被丢掉,其余字段照写,droppedFields里报readonly;开了strictReadonlyWrites则整笔拒收。isSystem)照写,汇总重算本身就是这条路,不受影响。新建记录时带的初值照旧保留(种子数据、历史导入的预算合计,按 rule-validator 里 RUNTIME_OWNED_FIELD_TYPES 的排除理由对 summary 是错的:summary 是「存储列」不是「读时计算」 #6014 的既有设计)。readonly: true的汇总字段带一个初值,直到下一次子记录变动重算为止;这一半留在 objectql: a Field.summary roll-up withoutreadonly: trueaccepts a person's write — REST PATCH and import store the typed value until the next recompute #34672 继续处理(席位 6949162788),所以本 PR 写Part of #34672,卡不随合并关闭。回滚即撤回本 PR,无数据迁移。packages/objectql/src/engine-top-level.ts(updateStaticReadonlySubject与新的summaryFieldsLockedOnUpdate)、packages/objectql/src/engine-summary-update-lock.test.ts、packages/rest/src/import-summary-update-lock-34672.test.ts。pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-summary-update-lock.test.ts,预期 11 条全过;把engine-top-level.ts里summaryFieldsLockedOnUpdate(schema)换成[]后其中 5 条变红。check-governed-merges判定非受管,L1 与契约复审通过后由区自行落地。What changes
A roll-up
summaryfield is read-only on update whether or not the author declaredreadonly: true.packages/objectql/src/engine-top-level.tsupdateStaticReadonlySubject(schema, wallJudgesOrganization)is the one schema view every update-side staticreadonlypass judges: the pre-hook hide pass (engine-update.ts, whatbeforeUpdateis shown), the by-id strip and the predicate (multi) strip (what is stored),staticReadonlyStoredView(read by thereadonlyWhenstrips and the master-detail settlement), and theupdate-mode preview inengine-validate.ts. It now also reads everysummaryfield asreadonly: true. So all five take the same key, report it throughonFieldsDropped/droppedFieldswith reasonreadonly, and refuse it understrictReadonlyWrites(ERR_READONLY_FIELD_REJECTED).summaryFieldsLockedOnUpdate(schema): thesummaryfields not already declaredreadonly: true, keyed ontype === 'summary'literally.stripComputedWriteFieldsdoc points at the new lock: that door runs in every context, so it would also take the recompute's own write; this one exemptsisSystem.content/docs/data-modeling/fields.mdx: one paragraph under the summary field section..changeset/34672-summary-readonly-on-update.md:patchon@objectstack/objectql, BREAKING, the one-line fix, ADR-0087not-required (no-migration-prescription).No new drop reason, no spec key: reason
readonly, asautonumberalready rides it without the flag (#5503).Why
The card measured on 18.5.0: a sales rep's
PATCHofcrm_quote_line_item.cb_converted_quantitystored90with no order behind it; a manager'sPATCHor an import update movedcrm_opportunity.cb_actual_won_amountfrom619469.03to2;crm_account.cb_order_amounttook55. Each value stayed until a child write recomputed the roll-up, and downstream defaults read it. The spec already sayssummaryis "never client-written" (COMPUTED_VALUE_TYPES); the update path did not enforce it.Why the
readonlystrip and not thecomputeddoor:stripComputedWriteFieldsruns in every context,isSystemincluded, so it would also take the roll-up recompute's write (recomputeSummarieswrites the parent throughupdate()withisSystem: trueandSUMMARY_RECOMPUTE_WRITE), and the spec describescomputedas a formula with no column. The staticreadonlystrip already skipsisSystemwrites (staticReadonlyStripRuns = !isSystem), so the recompute, the backfill and the enable refresh keep writing without reading the marker.Insert is NOT narrowed. A create keeps a caller's value as the field's starting value. The
summarynote onRUNTIME_OWNED_FIELD_TYPES(packages/objectql/src/validation/rule-validator.ts, the #6014 note) keeps the type out of the insert-side strip on purpose: seed data and a historical import may carry a pre-computed total, andinitializeSummaryFieldsseeds only the roll-ups the caller left out. This PR does not overturn it; the insert half is reported to the seat as a finding.Tests
packages/objectql/src/engine-summary-update-lock.test.ts(new, 11 cases), one account whoseorder_totalis asumroll-up with noreadonly, beside the same roll-up declaredreadonly: true, written as a signed-in person:readonly, the rest of the payload is written;multi: true): dropped from every matched row, reported once;strictReadonlyWrites: by-id and predicate both refused (codeERR_READONLY_FIELD_REJECTED,fields,drops,operation), nothing written;update-mode preview reports the same drop;isSystemwrite of the column is kept;readonly: trueroll-up answers the same, and a payload naming both reports both in one event;summaryFieldsLockedOnUpdate.packages/rest/src/import-summary-update-lock-34672.test.ts(new, 3 cases), real ObjectQL + protocol + SQLite:memory:through the HTTP routes as a signed-in person:PATCH /api/v1/data/:object/:id;POST /api/v1/data/:object/importwithwriteMode: 'update', dry run and commit (each row'sdroppedFieldsand the stored value); the declaredreadonly: truecontrol on both doors.''skips every type check, so a number, boolean, date, datetime or time column stores an empty string — normalise it to null at the door (seam from objectui#10813) #20308 blank-typed-value pins. Each sends a blank for every typed column,f_summaryincluded, and asserted each landsnull. On update thesummaryblank is now dropped, so:packages/objectql/src/engine-blank-typed-value-door.test.ts, case "update by id and update by predicate": every other typed column reaches the driver asnull, and nof_summaryis sent;packages/rest/src/rest-data-blank-typed-value.test.ts(SQLite), the PATCH, batch update and updateMany doors: every other typed column storesnull, andf_summarykeeps its seeded7.Ablation (
node scripts/ablation-replace.mjs, on 7aebcc3):const rollUps = summaryFieldsLockedOnUpdate(schema);replaced byconst rollUps: string[] = [];(anchor x1 → x0, blobc112f3aea19e→b4d66f559710). The suites import the engine from source. Result:Tests 6 failed | 14 passed (20).isSystem, insert and the two unit pins.c112f3aea19e== HEAD,git diff HEADempty.Acceptance notes
mainwhile PR fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709 (objectql: a predicate update (multi: true) resolves the parent once for the matched set, so a rule reading a parent roll-up does not answer as it does one by one #34465, same area, editsengine-update.ts) is still open, on the seat's go-ahead; this PR edits no line ofengine-update.ts.git merge-tree --write-treeof 7aebcc3 against fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709's head13741cb9and against feat(objectql): refuse a nested-relation condition and a lookup dimension up front on a driver without the readableIdsLeaf capability #34565's head779d1aa3: both exit 0. feat(objectql): refuse a nested-relation condition and a lookup dimension up front on a driver without the readableIdsLeaf capability #34565 then landed andmain(6091b64) is merged here (65f7837). Against fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709's current head18f3774a,git merge-tree --write-treeof the final head 76acd4f exits 0. Whichever of fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709 and this PR lands second mergesmainand re-runs the affected pins.packages/rest/src(the import door end to end), and the forced change topackages/rest/src/rest-data-blank-typed-value.test.ts.POSTwith a summary value is kept until the next child write) is NOT outside the card: its Expected covers creates too (seat contract review delta 6949128257, scope note corrected on objectql: a Field.summary roll-up withoutreadonly: trueaccepts a person's write — REST PATCH and import store the typed value until the next recompute #34672 as 6949162788). It is deferred, so this PR isPart of #34672and the card stays open for the create side.content/docs/data-modeling/fields.mdxby91202760(prose only, over the reviewed head76acd4f2): an import withwriteMode: 'upsert'drops a summary value on the rows it updates and keeps it on the rows it creates; a historical import (treatAsHistorical: true, writing withpreserveAudit) keeps the value on update, as it keeps any other read-only value it sends; undoing an ordinary import restores rows through an ordinary update, so a summary value an import committed before this rule is not put back by the undo and stays until the next child write recomputes it.readonlyreads "read-only (readonly: true)". It already coversautonumberwithout the flag; it now coverssummarytoo. Unchanged here: it shows only on a refusal that mixes reasons.Verification
Final head
8d567553: a merge ofmain(46991d0e, 63 first-parent commits) over91202760, with no conflict (git show --remerge-diffempty). The PR's delta againstmainis byte-for-byte the delta91202760carried (same 7 files, +536 / -8). Records at91202760: L1 delta ACCEPT 6948959772, contract review delta PASS 6949128257. The battery, the objectql suite and the PR's pins below ran on8d567553.Full dogfood battery
8d567553, under oneos-verify-lock.shhold (VERDICT command-exit 0):pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' buildexit 0, thenpnpm --filter @objectstack/dogfood test(no shard, no path):Test Files 479 passed | 3 skipped (482),Tests 4072 passed | 68 skipped (4140), exit 0. No failure.65f7837fgaveTest Files 478 passed | 3 skipped (481),Tests 4055 passed | 68 skipped (4123);a4f80eb9the same, all green.Local runs
pnpm --filter @objectstack/objectql teston8d567553(same lock hold): exit 0,Test Files 607 passed (607),Tests 13667 passed (13667). Earlier, typecheck + suite on65f7837f: exit 0,Tests 13617 passed (13617).pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/import-summary-update-lock-34672.test.ts src/rest-data-blank-typed-value.test.tson8d567553: exit 0,Test Files 2 passed (2),Tests 10 passed (10).pnpm check:facade-delegation-onlyon8d567553: exit 0 (protocol.ts11694 lines, ceiling 11705).node scripts/pm/overlap-check.mjson8d567553:VERDICT clean exit 0againstmain46991d0e, fix(audit): a search the server widens never names a column the caller may not query #34817 and fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709.pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/rest-data-blank-typed-value.test.ts src/import-summary-update-lock-34672.test.ts src/import-row-dropped-fields-20701.test.tson76acd4f2:Test Files 3 passed (3),Tests 20 passed (20).node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackon76acd4f2: 100 derived gate commands, each:: exit 0;--ranreconciliation: 100 derived famil(ies) accounted for — 100 run, 0 NOT-MEASURED.check:type-check-debtfirst exited 3 (lock queue timeout behind the dogfood run) and re-measured OK after it. The per-command log is kept with the seat.@objectstack/restsuite and the other packages: CI Test Core.91202760: every check-run success or skipped (59 runs).8d567553(55 runs): 38 success, 15 skipped,Test Core (7/10)failure and theTest Coreaggregate cancelled. The one failing test ispackages/qa/scenarios/test/skill-evals/skill-evals.test.ts("--regrade … a reworded case keeps its record bytes"),Test timed out in 5000ms(it took 6810ms). That file landed onmaintoday and this PR does not touchpackages/qa/scenarios;Test Core (7/10)is green onmain46991d0e. Lint & Repo Gates, TypeScript Type Check, Build Core, Check Changeset, Dogfood Regression Gate and Governed Surface Queue Guard: success.Human Minimum
packages/specholds no runtime logic. (packages/specnot touched)pnpm lintis CI's run (not run locally).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Taken over by repo:objectstack#3 area o3-J (claim 6948796553 on #34672, seat 2 hand-off 6948320778).
🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX